<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ name: 'home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card" shadow>
      <el-table border :data="limits" v-loading="loading">
        <el-table-column label="序号" width="50" type="index">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称"> </el-table-column>
        <el-table-column prop="path" label="权限路径"> </el-table-column>
        <el-table-column prop="level" label="权限等级" #default="{ row }">
          <el-tag effect="dark" v-show="row.level == 0"> 一级 </el-tag>
          <el-tag effect="dark" type="success" v-show="row.level == 1">
            二级
          </el-tag>
          <el-tag effect="dark" type="warning" v-show="row.level == 2">
            三级
          </el-tag>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      limits: [],
      loading: false,
    };
  },
  methods: {
    async initLimitsList() {
      try {
        this.loading = true;
        let data = await this.$api.getRightsList("list");
        console.log(1111, data);
        this.limits = data;
      } catch (error) {
        console.log("RoleView-initLimitsList-error:", error);
      } finally {
        this.loading = false;
      }
    },
  },
  created() {
    this.initLimitsList();
  },
};
</script>